<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h1>这是一个Json的demo</h1>
	<br />
	<table border="1" width="50%">
		<tr>
			<th>name</th>
			<th>age</th>
		</tr>
		<tr>
			<td id="nametd">null</td>
			<td id="agetd">null</td>
		</tr>
	</table>

	<button id="btn1" onclick="ajaxSend();">send</button>

</body>
<script type="text/javascript" src="<c:url value='/js_files/myajaxTool.js'/>"></script>
<script type="text/javascript">
	function ajaxSend() {
		ajaxSendDyn("/Json/JsonDemoServlet", insertIntoTable);
	}
	//将一个jsonObj insert到table中
	function insertIntoTable(jsonObj) {
		var nametd = document.getElementById("nametd");
		var agetd = document.getElementById("agetd");
		nametd.innerHTML = jsonObj.name;
		agetd.innerHTML = jsonObj.age;
	}
</script>

</html>